#pragma once

#include <QtWidgets/QMainWindow>
#include "ui_DetectionClient.h"
#include <qimage.h>
#include <qstring.h>
#include <qurl.h>
//#include <qnetwork.h>
#include <qnetworkaccessmanager.h>
#include <qnetworkreply.h>
#include <qnetworkrequest.h>
#include <qdatetime.h>
#include <qmouseeventtransition.h>

#include <qmediaplayer.h>
#include <qwidget.h>

#include "http_client.h"
#include "multi_detect_page.h"
#include "model_manage_page.h"
#include "local_data_page.h"
#include "realtime_data_page.h"
#include "upload_page.h"
#include "analyse_page.h"
#include "video_detect.h"

#include <map>
#include <string>


class DetectionClient : public QMainWindow
{
    Q_OBJECT

public:
    DetectionClient(QWidget *parent = nullptr);
    ~DetectionClient();

    bool eventFilter(QObject* obj, QEvent* event);
protected:
    virtual void resizeEvent(QResizeEvent* event) override;

private:
    Ui::DetectionClientClass ui;

    QImage* icon = nullptr;
    QString icon_path = "media\\favicon.ico";
    QString base_url = "http://www.liangchengmeijing.com:10003";

    QNetworkReply* reply = nullptr;
    QNetworkAccessManager* manager = nullptr;

    multi_detect_page* md_page;
    model_manage_page* mm_page;
    local_data_page* ld_page;
    realtime_data_page* rt_page;
    upload_page* u_page;
    analyse_page* a_page;

    QString now_select_img;

    QFile* video_file;
    QString save_video_path;
    video_detect* player_widget = nullptr;
    


    void upload_detect(QString file_path);
    void single_add_label_slot();

    std::map<std::string, int>memu_map;
    

private slots:

    void login_slot();
    void reset_login_info_slot();
    void single_detect_slot();
    
    //void login_replyFinished(QNetworkReply*);

    void login_replyFinished();
    void single_detect_replyFinished();
    void video_detect_replyFinished();
    void video_detect_replyRead();
};
